home *** CD-ROM | disk | FTP | other *** search
/ Drivin' Route 66 / Drivin' Route 66 (1995)(Creative Multimedia)[Mac-PC].iso / mac / RTMM.DIR / 00384_Script_UTILS < prev    next >
Text File  |  1995-10-03  |  14KB  |  505 lines

  1. -- things that should always be done
  2. on generalsetup
  3.   global filerPath
  4.   hideStateFrames
  5.   if length(filerPath) = 0 then
  6.     clearItinerary
  7.   end if
  8.   lowLevInit
  9.   noSprites
  10. end
  11.  
  12.  
  13. on noSprites
  14.   repeat with p = 1 to 48
  15.     puppetSprite p,0
  16.   end repeat
  17.   updateStage
  18. end 
  19.  
  20. on doPicon thePic
  21.   -- alert string(thePic)
  22.   if thePic = 1 then
  23.     goCars
  24.   else if thePic = 2 then
  25.     goStories
  26.   else
  27.     goCruiseControl
  28.   end if
  29. end
  30.  
  31. on goCruiseControl
  32.   global ccFYI,jumpMode
  33.   put "cc" into jumpmode
  34.   put the frame into ccFYI
  35.   noSprites
  36.   go frame "fader2"
  37.   go movie "RTCC.dir"
  38.   --put "cc" into jumpmode
  39.   --noSprites
  40.   --fixPicons
  41.   --puppetTransition 0
  42.   --updateStage
  43.   --unloadcast
  44.   --go frame "fader"
  45.   --go frame "fader2"
  46.   --go frame ccFYI
  47. end 
  48.  
  49. on goStories
  50.   global stFYI,jumpMode
  51.   put "st" into jumpmode
  52.   put the frame into stFYI
  53.   noSprites
  54.   go frame "fader2"
  55.   go movie "RTSM.DIR"
  56.   --put "st" into jumpmode
  57.   --noSprites
  58.   --puppetTransition 0
  59.   --updateStage
  60.   --go frame "fader"
  61.   --go frame "fader2"
  62.   --puppetTransition 0
  63.   --updatestage
  64.   --fixPicons
  65.   --go frame stFYI
  66. end
  67.  
  68. on goCars
  69.   global carFYI,jumpMode
  70.   put "cr" into jumpmode
  71.   put the frame into carFYI
  72.   noSprites
  73.   go frame "fader2"
  74.   go movie "RTCM.DIR"
  75.   --put "cr" into jumpmode
  76.   --noSprites
  77.   --fixPicons
  78.   --puppetTransition 0
  79.   --updateStage
  80.   --go frame "fader"
  81.   --go frame "fader2"
  82.   --go frame carFYI
  83. end
  84.  
  85.  
  86. on fixMapPicons
  87.   repeat with s = 35 to 37
  88.     -- puppetSprite s,0
  89.     set the visible of sprite s to true
  90.   end repeat
  91.   updateStage
  92. end 
  93.  
  94. on goMainMap
  95.   fixMapPicons
  96.   prepMaps
  97.   dodelay
  98.   go frame "US MAP"
  99. end
  100.  
  101. on prepMaps
  102.   repeat with s = 14 to 17
  103.     puppetSprite s,0
  104.     set the visible of sprite s to false
  105.   end repeat
  106.   updateStage
  107. end
  108.  
  109.  
  110.  
  111. on prepSites
  112.   repeat with s = 14 to 17
  113.     puppetSprite s,0
  114.     set the visible of sprite s to false
  115.   end repeat
  116.   updateStage
  117.   set the visible of sprite 14 to true
  118.   set the visible of sprite 15 to true
  119.   updateStage
  120.   
  121. end
  122.  
  123. on hideStateFrames
  124.   repeat with s = 35 to 37
  125.     set the visible of sprite s to true
  126.   end repeat
  127.   preLoadCast 392,399
  128.   repeat with p = 3 to 11
  129.     set the visible of sprite p to false
  130.   end repeat
  131.   repeat with p = 40 to 45
  132.     puppetSprite p,0
  133.   end repeat
  134.   updateStage
  135. end 
  136.  
  137. on findStateNumber
  138.   put field "stateData" into temp
  139.   repeat with y = 1 to the number of lines in temp
  140.     if the name of cast (the castNum of sprite 1) = line y of temp then
  141.       put y-1 into y
  142.       if y = 0 then put 1 into y
  143.       return y
  144.     end if
  145.   end repeat
  146.   beep
  147.   return 1 -- not possible
  148. end 
  149.  
  150. on findSite
  151.   put the name of cast (the castNum of sprite 1) into siteName
  152.   delete char 1 of siteName
  153.   put integer(siteName) into siteNum
  154.   return siteNum
  155. end 
  156.  
  157. on findState
  158.   put field "stateData" into temp
  159.   repeat with y = 1 to the number of lines in temp
  160.     if the name of cast (the castNum of sprite 1) = line y of temp then
  161.       return line y of field "SiteBaseAddress"
  162.     end if
  163.   end repeat
  164.   beep
  165.   return 1 -- not possible
  166. end
  167.  
  168. on getStateNumFromSite
  169.   put field "stateData" into temp
  170.   put getCurrentState() into y
  171.   return y
  172.   beep
  173.   return 1 -- not possible
  174. end
  175.  
  176. on getCurrentState -- USE THIS ONLY IN USITES!!!
  177.   put field "WholeSiteAddress" into temp
  178.   put 0 into y
  179.   -- òmodified:
  180.   put the name of cast (the castNum of sprite 1) into siteName
  181.   delete char 1 of siteName
  182.   put integer(siteName) into siteNum
  183.   -- ò
  184.   repeat with y = 1 to the number of lines in temp
  185.     
  186.     put integer(line y of temp) into highestState
  187.     if siteNum >= highestState then
  188.       -- keep searching
  189.     else
  190.       put integer(line y-1 of temp) into highestState
  191.       
  192.       return y-1
  193.     end if
  194.     
  195.   end repeat
  196.   return y-1 -- must be CA
  197. end 
  198.  
  199. on getPadded input
  200.   put string(integer(input)) into temp
  201.   if length(temp) < 2 then
  202.     put "0" before temp
  203.   end if
  204.   return temp
  205. end 
  206.  
  207. on synchStory
  208.   global storyTarget,theButton,theButtonName
  209.   if soundBusy(1) then
  210.     repeat while soundBusy(1)
  211.       if the mouseDown then
  212.         --        repeat with s = 14 to 18
  213.         --          puppetSprite s,1
  214.         --        end repeat
  215.         --        puppetTransition 0
  216.         --        updateStage
  217.         --        -- put mouseCast() into theButton
  218.         --        -- put the name of cast theButton into theButtonName
  219.         --        --put theButtonName
  220.         --        -- u,?,66,exit,turn
  221.         --        put 0 into doHilite
  222.         --        repeat with s = 14 to 18
  223.         --          if rollover(s) then
  224.         --            put 1 into doHilite
  225.         --            exit repeat
  226.         --          end if
  227.         --        end repeat
  228.         --        if doHilite then
  229.         --          if s < 18 then -- it's a normal sign
  230.         --            set the castNum of sprite s to the castNum of sprite s+8
  231.         --            updateStage
  232.         --            repeat while the mouseDown
  233.         --              nothing
  234.         --            end repeat
  235.         --            set the castNum of sprite s to the castNum of sprite s-8
  236.         --            updateStage
  237.         --            if s = 14 then -- u-turn
  238.         --              sound stop 1
  239.         --              sound stop 2
  240.         --              repeat with s = 14 to 18
  241.         --                puppetSprite s,0
  242.         --              end repeat
  243.         --              puppetTransition 0
  244.         --              updateStage
  245.         --              if the frame < 45 then
  246.         --                go "menu 1"
  247.         --              else
  248.         --                go "menu 2"
  249.         --              end if
  250.         --              
  251.         --            else if s = 15 then -- ?
  252.         --              alert "help"
  253.         --            else if s = 16 then -- home
  254.         --              sound stop 1
  255.         --              sound stop 2
  256.         --              repeat with s = 14 to 18
  257.         --                puppetSprite s,0
  258.         --              end repeat
  259.         --              puppetTransition 0
  260.         --              updateStage
  261.         --              -- alert "go to main menu"
  262.         --            else if s = 17 then -- quit
  263.         --              sound stop 1
  264.         --              sound stop 2
  265.         --              repeat with s = 14 to 18
  266.         --                puppetSprite s,0
  267.         --              end repeat
  268.         --              puppetTransition 0
  269.         --              updateStage
  270.         --              quit
  271.         --            end if
  272.         --            
  273.         --          else -- it's the turn signals!
  274.         --            put the locH of sprite s into midPt
  275.         --            if the mouseH < midPt then -- go back
  276.         --              set the castNum of sprite s to the castNum of sprite s-1
  277.         --              updateStage
  278.         --              repeat while the mouseDown
  279.         --                nothing
  280.         --              end repeat
  281.         --              set the castNum of sprite s to the castNum of sprite s+1
  282.         --              puppetSprite s,0
  283.         --              updateStage
  284.         --              if marker(-1) > 29 then
  285.         --                go marker(-1)
  286.         --              else
  287.         --                go "story 12" 
  288.         --              end if
  289.         --            else -- go forth
  290.         --              set the castNum of sprite s to the castNum of sprite s+1
  291.         --              updateStage
  292.         --              repeat while the mouseDown
  293.         --                nothing
  294.         --              end repeat
  295.         --              puppetSprite s,0
  296.         --              set the castNum of sprite s to the castNum of sprite s-1
  297.         --              updateStage
  298.         --              if marker(1) < 67 then
  299.         --                go marker(1)
  300.         --              else
  301.         --                go "story 1" 
  302.         --              end if
  303.         --            end if
  304.         --          end if
  305.         --        end if
  306.         
  307.         --PATCH:
  308.         exit repeat
  309.       end if
  310.     end repeat
  311.     -- What to do when all audio has played for a story:
  312.     --òNotice a need for a special case @end
  313.     if ((the frame + 1) = marker(1)) OR (the frame = 66) OR (the mouseDown) then
  314.       sound stop 1
  315.       sound stop 2
  316.       -- repeat with s = 14 to 18
  317.       --   puppetSprite s,0
  318.       -- end repeat
  319.       puppetTransition 0
  320.       updateStage
  321.       if the frame < 45 then
  322.         go "menu 1"
  323.       else
  324.         go "menu 2"
  325.       end if
  326.     end if
  327.   else
  328.     --    if the mouseDown then
  329.     --      
  330.     --      repeat with s = 14 to 18
  331.     --        puppetSprite s,1
  332.     --      end repeat
  333.     --      puppetTransition 0
  334.     --      updateStage
  335.     --      -- put mouseCast() into theButton
  336.     --      -- put the name of cast theButton into theButtonName
  337.     --      --put theButtonName
  338.     --      -- u,?,66,exit,turn
  339.     --      put 0 into doHilite
  340.     --      repeat with s = 14 to 18
  341.     --        if rollover(s) then
  342.     --          put 1 into doHilite
  343.     --          exit repeat
  344.     --        end if
  345.     --      end repeat
  346.     --      if doHilite then
  347.     --        if s < 18 then -- it's a normal sign
  348.     --          set the castNum of sprite s to the castNum of sprite s+8
  349.     --          updateStage
  350.     --          repeat while the mouseDown
  351.     --            nothing
  352.     --          end repeat
  353.     --          set the castNum of sprite s to the castNum of sprite s-8
  354.     --          updateStage
  355.     --          if s = 14 then -- u-turn
  356.     --            sound stop 1
  357.     --            sound stop 2
  358.     --            repeat with s = 14 to 18
  359.     --              puppetSprite s,0
  360.     --            end repeat
  361.     --            puppetTransition 0
  362.     --            updateStage
  363.     --            if the frame < 45 then
  364.     --              go "menu 1"
  365.     --            else
  366.     --              go "menu 2"
  367.     --            end if
  368.     --            
  369.     --          else if s = 15 then
  370.     --            
  371.     --          else if s = 16 then
  372.     --            
  373.     --          else if s = 17 then
  374.     --            
  375.     --          end if
  376.     --          
  377.     --        else -- it's the turn signals!
  378.     --          put the locH of sprite s into midPt
  379.     --          if the mouseH < midPt then -- go back
  380.     --            set the castNum of sprite s to the castNum of sprite s-1
  381.     --            updateStage
  382.     --            repeat while the mouseDown
  383.     --              nothing
  384.     --            end repeat
  385.     --            set the castNum of sprite s to the castNum of sprite s+1
  386.     --            puppetSprite s,0
  387.     --            updateStage
  388.     --            if marker(-1) > 29 then
  389.     --              go marker(-1)
  390.     --            else
  391.     --              go "story 12" 
  392.     --            end if
  393.     --          else -- go forth
  394.     --            set the castNum of sprite s to the castNum of sprite s+1
  395.     --            updateStage
  396.     --            repeat while the mouseDown
  397.     --              nothing
  398.     --            end repeat
  399.     --            puppetSprite s,0
  400.     --            set the castNum of sprite s to the castNum of sprite s-1
  401.     --            updateStage
  402.     --            if marker(1) < 67 then
  403.     --              go marker(1)
  404.     --            else
  405.     --              go "story 1" 
  406.     --            end if
  407.     --          end if
  408.     --        end if
  409.     --      end if
  410.     --    end if
  411.     if ((the frame + 1) = marker(1)) OR (the frame = 66) OR (the mouseDown) then
  412.       sound stop 1
  413.       sound stop 2
  414.       -- repeat with s = 14 to 18
  415.       --   puppetSprite s,0
  416.       -- end repeat
  417.       puppetTransition 0
  418.       updateStage
  419.       if the frame < 45 then
  420.         go "menu 1"
  421.       else
  422.         go "menu 2"
  423.       end if
  424.     end if
  425.   end if
  426. end 
  427.  
  428. on gomenu
  429.   global storyTarget
  430.   -- Handles mouseDown in menu
  431.   repeat with s = 3 to 11
  432.     if rollOver(s) then
  433.       -- set the foreColor of sprite s to 209
  434.       set the visible of sprite s to 1
  435.       updateStage
  436.       -- Put here to ensure a valid click:
  437.       -- put the name of cast mouseCast() into cName
  438.       repeat while the mouseDown
  439.         nothing
  440.       end repeat
  441.       sound stop 1
  442.       sound stop 2
  443.       put the name of cast mouseCast() into cName
  444.       if char 1 of cName = "s" then
  445.         delete char 1 of cName
  446.         put integer(cName) into storyTarget
  447.         -- put storyTarget
  448.         go ("state" && string(storyTarget))
  449.       end if
  450.       exit repeat
  451.     else
  452.       -- set the foreColor of sprite s to 29
  453.       set the visible of sprite s to 0
  454.     end if
  455.   end repeat
  456.   updateStage
  457. end 
  458.  
  459. on goSite
  460.   global storyTarget
  461.   -- Handles mouseDown in menu
  462.   repeat with s = 3 to 11
  463.     if rollOver(s) then
  464.       -- set the foreColor of sprite s to 209
  465.       set the visible of sprite s to 1
  466.       updateStage
  467.       -- Put here to ensure a valid click:
  468.       -- put the name of cast mouseCast() into cName
  469.       repeat while the mouseDown
  470.         nothing
  471.       end repeat
  472.       sound stop 1
  473.       sound stop 2
  474.       put the name of cast mouseCast() into cName
  475.       if char 1 of cName = "s" then
  476.         delete char 1 of cName
  477.         put integer(cName) into storyTarget
  478.         -- put storyTarget
  479.         go ("site" && string(storyTarget))
  480.       end if
  481.       exit repeat
  482.     else
  483.       -- set the foreColor of sprite s to 29
  484.       set the visible of sprite s to 0
  485.     end if
  486.   end repeat
  487.   updateStage
  488. end 
  489.  
  490.  
  491. on goState
  492.   
  493. end
  494.  
  495.  
  496. on dealWithManics
  497. end 
  498.  
  499. on SetupSigns -- Inits Sign Buttons
  500.   --  repeat with p = 40 to 45
  501.   --    -- set the visible of sprite s to true -- you never know...
  502.   --    puppetSprite p,1
  503.   --  end repeat
  504.   updatestage
  505. end